package com.vincent.filepicker.filter.entity;

import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

/**
 * Created by Vincent Woo
 * Date: 2016/10/10
 * Time: 17:44
 */

public class ImageFile extends BaseFile implements Sequenceable {
    private int orientation;   //0, 90, 180, 270

    public int getOrientation() {
        return orientation;
    }

    public void setOrientation(int orientation) {
        this.orientation = orientation;
    }

    @Override
    public boolean marshalling(Parcel dest) {
        dest.writeString(getPath());
        dest.writeInt(orientation);
        return true;
    }

    @Override
    public boolean unmarshalling(Parcel in) {
        setPath(in.readString());
        orientation = in.readInt();
        return true;
    }

    public static final Sequenceable.Producer
            PRODUCER = new Sequenceable.Producer
            () {
        public BaseFile createFromParcel(Parcel in) {
            ImageFile instance = new ImageFile();
            instance.unmarshalling(in);
            return instance;
        }
    };
}
